home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / info-service / gopher / incoming / gopher.query.patch < prev    next >
Encoding:
Text File  |  1992-07-19  |  10.2 KB  |  359 lines

  1. Common subdirectories: gopher1.01/doc and gopher1.01.q/doc
  2. Common subdirectories: gopher1.01/examples and gopher1.01.q/examples
  3. Common subdirectories: gopher1.01/gopher and gopher1.01.q/gopher
  4. Common subdirectories: gopher1.01/gopherd and gopher1.01.q/gopherd
  5. Common subdirectories: gopher1.01/mindexd and gopher1.01.q/mindexd
  6. Common subdirectories: gopher1.01/misc and gopher1.01.q/misc
  7. Common subdirectories: gopher1.01/object and gopher1.01.q/object
  8. Common subdirectories: gopher1.01/examples/.cap and gopher1.01.q/examples/.cap
  9. Common subdirectories: gopher1.01/examples/Sample Directory and gopher1.01.q/examples/Sample Directory
  10. Common subdirectories: gopher1.01/examples/Sample Directory/.cap and gopher1.01.q/examples/Sample Directory/.cap
  11. Common subdirectories: gopher1.01/examples/Sample Directory/wais-index and gopher1.01.q/examples/Sample Directory/wais-index
  12. diff -cr gopher1.01/gopher/gopher.c gopher1.01.q/gopher/gopher.c
  13. *** gopher1.01/gopher/gopher.c    Mon Jun 22 09:17:30 1992
  14. --- gopher1.01.q/gopher/gopher.c    Mon Jul 20 11:57:47 1992
  15. ***************
  16. *** 10,15 ****
  17. --- 10,76 ----
  18.   #include <sys/file.h>
  19.   void describe_gopher();
  20.   
  21. + #define MAX_PROMPTS 12
  22. + void do_query(InGopher,ZeGopher)
  23. + GopherStruct *InGopher,*ZeGopher;
  24. + {
  25. +    char *Option[MAX_PROMPTS];
  26. +    int i;
  27. +    char Response[MAX_PROMPTS][MAXSTR];
  28. +    char sErrMsg[MAXSTR];          /* Error line on screen */
  29. +    int NumPrompts;
  30. +    char ReturnType;
  31. +    char *p;
  32. +    char selector[1024];
  33. +    char return_selector[1024];
  34. +    GScpy(ZeGopher,InGopher);
  35. +    for(i=0; i<MAX_PROMPTS;i++) Response[i][0]='\0';
  36. +    sErrMsg[0]='\0';
  37. +    strcpy(selector,GSgetPath(ZeGopher));
  38. +    p=strtok(selector,"|");
  39. +    if (!p) return;
  40. +    ReturnType= *p;
  41. +    p=strtok(NULL,"|");
  42. +    if (!p) return;
  43. +    NumPrompts=atoi(p);
  44. +    i=0;
  45. +    while(i<NumPrompts) {
  46. +        p=strtok(NULL,"|");
  47. +        Option[i]=p;
  48. +        i++;
  49. +    }
  50. +    Option[i]='\0';
  51. +    p=strtok(NULL,"|"); /* p now equals selector (if any) */
  52. +    if (p!=NULL) {
  53. +       strcpy(return_selector,p);
  54. +    } else {
  55. +        return_selector[0]='\0';
  56. +    }
  57. +    if (NumPrompts == 1)  {
  58. +      strcat(Option[0],": ");
  59. +      CURGetOneOption(CursesScreen, Option[0], Response[0]);
  60. +    } else {
  61. +      Get_Options(GSgetTitle(ZeGopher), sErrMsg,NumPrompts,Option,Response);
  62. +    }
  63. +    GSsetType(ZeGopher,ReturnType);
  64. +    for (i=0; i<NumPrompts; i++) {
  65. +        if (i>0 || return_selector[0]) strcat(return_selector,"\t");
  66. +        strcat(return_selector,Response[i]);
  67. +    }   
  68. +    GSsetPath(ZeGopher,return_selector);
  69. +    return;
  70. + }
  71.   /*
  72.   ** Open a connection to another host using telnet or tn3270
  73.   */
  74. ***************
  75. *** 675,681 ****
  76.        int iNum=0;
  77.        BOOLEAN bDone = FALSE;
  78.        char sTmp[80];
  79. !      GopherStruct *RootGopher;
  80.        int TypedChar;
  81.        /*** for getopt processing ***/
  82.        int c;
  83. --- 736,742 ----
  84.        int iNum=0;
  85.        BOOLEAN bDone = FALSE;
  86.        char sTmp[80];
  87. !      GopherStruct *RootGopher,*QueryGopher,*SelectedGopher;
  88.        int TypedChar;
  89.        /*** for getopt processing ***/
  90.        int c;
  91. ***************
  92. *** 685,690 ****
  93. --- 746,753 ----
  94.        int Garbled = TRUE;
  95.   
  96.        RootGopher = GSnew();
  97. +      QueryGopher = GSnew();
  98.        SavedLinenum[SavedLinePtr] = 1;
  99.   
  100.   
  101. ***************
  102. *** 774,785 ****
  103.         case '\n':
  104.              /*** Select the designated item ***/
  105.              iNum = iLine - 1;
  106. !            if (GSgetType(GDgetEntry(CurrentDir, iNum)) == A_DIRECTORY || 
  107. !            GSgetType(GDgetEntry(CurrentDir, iNum)) == A_INDEX) {
  108.               SavedLinenum[++SavedLinePtr] = iLine;
  109.               iLine=1;
  110.              }
  111. !            if (process_request(GDgetEntry(CurrentDir, iNum))==1)
  112.               iLine= iNum+1;
  113.              break;
  114.              
  115. --- 837,855 ----
  116.         case '\n':
  117.              /*** Select the designated item ***/
  118.              iNum = iLine - 1;
  119. !                if(GSgetType(GDgetEntry(CurrentDir, iNum)) == A_QUERY) {
  120. !                   do_query(GDgetEntry(CurrentDir,iNum),QueryGopher);
  121. !                   SelectedGopher = QueryGopher;
  122. !                } else {
  123. !                   SelectedGopher = GDgetEntry(CurrentDir,iNum);
  124. !                }
  125. !            if (GSgetType(SelectedGopher) == A_DIRECTORY || 
  126. !            GSgetType(SelectedGopher) == A_INDEX) {
  127.               SavedLinenum[++SavedLinePtr] = iLine;
  128.               iLine=1;
  129.              }
  130. !            if (process_request(SelectedGopher)==1)
  131.               iLine= iNum+1;
  132.              break;
  133.              
  134. ***************
  135. *** 1159,1164 ****
  136. --- 1229,1237 ----
  137.         showfile(ZeGopher);
  138.         break;
  139.   
  140. +      case A_QUERY:
  141. +           do_query(ZeGopher);
  142. +           break;
  143.        case A_INDEX:
  144.         Draw_Status("Searching Text...");
  145.         refresh();
  146. diff -cr gopher1.01/gopher/manager.c gopher1.01.q/gopher/manager.c
  147. *** gopher1.01/gopher/manager.c    Wed Jun 10 23:03:43 1992
  148. --- gopher1.01.q/gopher/manager.c    Mon Jul 20 11:58:04 1992
  149. ***************
  150. *** 72,77 ****
  151. --- 72,78 ----
  152.     int nNewPage, nMaxPages, iPageLen, iLastPageLen;
  153.   {
  154.        int i, iLoop, iOffset;
  155. +      char ch,query;
  156.   
  157.        /*** Clear the screen and redraw the top line **/
  158.        clear();
  159. ***************
  160. *** 109,115 ****
  161.              printw(" %s", c);
  162.   
  163.        }
  164. !       switch(GSgetType(GDgetEntry(gopherdir,iOffset)))
  165.            {
  166.            case A_DIRECTORY:
  167.              addch('/');
  168. --- 110,125 ----
  169.              printw(" %s", c);
  170.   
  171.        }
  172. !         ch=GSgetType(GDgetEntry(gopherdir,iOffset));
  173. !         if (ch==A_QUERY) {
  174. !            query=A_QUERY;
  175. !            ch= *GSgetPath(GDgetEntry(gopherdir,iOffset));
  176. !         } else {
  177. !            query='\0';
  178. !         }
  179. !                        
  180. !       switch(ch)
  181.            {
  182.            case A_DIRECTORY:
  183.              addch('/');
  184. ***************
  185. *** 123,128 ****
  186. --- 133,141 ----
  187.            case A_INDEX:
  188.              addstr(" <?>");
  189.              break;
  190. +          case A_QUERY:
  191. +            addstr(" <QUERY>");
  192. +            break;
  193.                case A_SOUND:
  194.              addstr(" <)");  /** It's supposed to look like a speaker! **/
  195.              break;
  196. ***************
  197. *** 138,144 ****
  198.              break;
  199.   
  200.                }
  201. !      }
  202.   }
  203.   
  204.   
  205. --- 151,158 ----
  206.              break;
  207.   
  208.                }
  209. !              if (query==A_QUERY) addstr(" [QUERY]");
  210. !     }
  211.   }
  212.   
  213.   
  214. Common subdirectories: gopher1.01/misc/Logging and gopher1.01.q/misc/Logging
  215. Common subdirectories: gopher1.01/misc/NeXT and gopher1.01.q/misc/NeXT
  216. Common subdirectories: gopher1.01/misc/Radio and gopher1.01.q/misc/Radio
  217. Common subdirectories: gopher1.01/misc/archie-gopher-gw and gopher1.01.q/misc/archie-gopher-gw
  218. Common subdirectories: gopher1.01/misc/go500 and gopher1.01.q/misc/go500
  219. Common subdirectories: gopher1.01/misc/gopher2ftp and gopher1.01.q/misc/gopher2ftp
  220. Common subdirectories: gopher1.01/misc/gopherdist and gopher1.01.q/misc/gopherdist
  221. Common subdirectories: gopher1.01/misc/gopherhunt and gopher1.01.q/misc/gopherhunt
  222. Common subdirectories: gopher1.01/misc/shell-utils and gopher1.01.q/misc/shell-utils
  223. Common subdirectories: gopher1.01/misc/waisgopher and gopher1.01.q/misc/waisgopher
  224. Common subdirectories: gopher1.01/misc/Radio/radio and gopher1.01.q/misc/Radio/radio
  225. Common subdirectories: gopher1.01/misc/Radio/radiod and gopher1.01.q/misc/Radio/radiod
  226. diff -cr gopher1.01/object/GSgopherobj.c gopher1.01.q/object/GSgopherobj.c
  227. *** gopher1.01/object/GSgopherobj.c    Thu Jun 11 17:20:22 1992
  228. --- gopher1.01.q/object/GSgopherobj.c    Mon Jul 20 11:56:26 1992
  229. ***************
  230. *** 222,227 ****
  231. --- 222,228 ----
  232.          case A_HTML:
  233.          case A_TN3270:
  234.          case A_MIME:
  235. +        case A_QUERY:
  236.   /*     case A_EVENT:
  237.          case A_CALENDAR:   not ready for prime time yet */
  238.         break;
  239. ***************
  240. *** 353,359 ****
  241.   #define    G_NAME    (1<<2)
  242.   #define    G_PORT    (1<<3)
  243.   #define    G_HOST    (1<<4)
  244. ! #define    G_ALL (G_PATH | G_TYPE | G_NAME | G_PORT | G_HOST)
  245.   
  246.   int
  247.   GSfromLink(gs, fd, host, port)
  248. --- 354,362 ----
  249.   #define    G_NAME    (1<<2)
  250.   #define    G_PORT    (1<<3)
  251.   #define    G_HOST    (1<<4)
  252. ! #define G_PROMPT      (1<<5)
  253. ! #define G_RETURNTYPE  (1<<6)
  254. ! #define    G_ALL (G_PATH | G_TYPE | G_NAME | G_PORT | G_HOST | G_PROMPT | G_RETURNTYPE)
  255.   
  256.   int
  257.   GSfromLink(gs, fd, host, port)
  258. ***************
  259. *** 364,370 ****
  260. --- 367,378 ----
  261.   {
  262.        int doneflags = 0;
  263.        char buf[1024];
  264. +      char Prompts[1024];
  265. +      char ReturnType;
  266. +      int NumPrompts=0;
  267.   
  268. +      Prompts[0]='\0';
  269.        while ((doneflags != G_ALL) && readline(fd, buf, 1024)) {
  270.         if (buf[0] == '#')
  271.              continue;   /* comment */
  272. ***************
  273. *** 374,381 ****
  274.         if (strncmp(buf, "Type=", 5)==0) {
  275.              GSsetType(gs, buf[5]);
  276.              doneflags |= G_TYPE;
  277.         }
  278. !       
  279.         if (strncmp(buf, "Name=", 5)==0) {
  280.              GSsetTitle(gs, buf+5);
  281.              doneflags |= G_NAME;
  282. --- 382,401 ----
  283.         if (strncmp(buf, "Type=", 5)==0) {
  284.              GSsetType(gs, buf[5]);
  285.              doneflags |= G_TYPE;
  286. +                if (buf[5]!=A_QUERY) doneflags |= (G_PROMPT | G_RETURNTYPE);
  287.         }
  288. !       if (strncmp(buf, "ReturnType=",11)==0) {
  289. !                ReturnType = buf[11];
  290. !                doneflags |= G_RETURNTYPE;
  291. !       }
  292. !           if (strncmp(buf,"Prompt=",7)==0) {
  293. !                strcat(Prompts,"|");
  294. !                strcat(Prompts,buf+7);
  295. !                NumPrompts++;
  296. !                doneflags |= G_PROMPT;
  297. !           }
  298. !     
  299.         if (strncmp(buf, "Name=", 5)==0) {
  300.              GSsetTitle(gs, buf+5);
  301.              doneflags |= G_NAME;
  302. ***************
  303. *** 406,411 ****
  304. --- 426,443 ----
  305.              GSsetNum(gs, atoi(buf+5));
  306.         
  307.        }
  308. +      if (doneflags==G_ALL && GSgetType(gs)==A_QUERY) { /*patch selector */
  309. +        char buffer[1024];
  310. +        sprintf(buffer,"%c|%d",ReturnType,NumPrompts);
  311. +        if (NumPrompts) strcat(buffer,Prompts);
  312. +        if (strcmp(GSgetPath(gs),"")) {
  313. +            strcat(buffer,"|");
  314. +            strcat(buffer,GSgetPath(gs));
  315. +      }
  316. +        GSsetPath(gs,buffer);
  317. +      }
  318.        return ((doneflags == G_ALL) ? 0 : -1); /* 0 == success */
  319.   }
  320.   
  321. diff -cr gopher1.01/object/GSgopherobj.h gopher1.01.q/object/GSgopherobj.h
  322. *** gopher1.01/object/GSgopherobj.h    Thu Jun 11 17:20:09 1992
  323. --- gopher1.01.q/object/GSgopherobj.h    Mon Jul 20 11:56:24 1992
  324. ***************
  325. *** 19,25 ****
  326.   #define A_TN3270    'T'
  327.   #define A_MIME      'M'
  328.   #define A_EOI        '.'
  329.   
  330.   /** Our Gopher Object Type **/
  331.   
  332. --- 19,25 ----
  333.   #define A_TN3270    'T'
  334.   #define A_MIME      'M'
  335.   #define A_EOI        '.'
  336. ! #define A_QUERY     'q'
  337.   
  338.   /** Our Gopher Object Type **/
  339.   
  340.